package com.cj.pj.sys.controller;

import com.cj.pj.sys.common.pojo.JsonResult;
import com.cj.pj.sys.pojo.Dept;
import com.cj.pj.sys.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dept/")
public class SysDeptController {
    @Autowired
    SysDeptService sysDeptService;

    @RequestMapping("doFindObjects")
    public JsonResult findObject(){
        return new JsonResult(sysDeptService.findObject());
    }

    @RequestMapping("doSaveObject")
    public JsonResult saveObject(Dept dept){
        sysDeptService.insert(dept);
        return new JsonResult("chegngogn ");
    }

    @RequestMapping("doUpdateObject")
    public JsonResult updateObject(Dept dept){
        sysDeptService.updateById(dept);
        return new JsonResult(("更新成功"));
    }

    @RequestMapping("doDeleteObject")
    public JsonResult deleteObject(Integer id){
        sysDeptService.deleteById(id);
        return new JsonResult("删除成功");
    }

}
